package com.ymatou.iapi.notify.testcase;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.iapi.notify.parameter.CleanNotifyByNotifyIdBean;
import com.ymatou.iapi.notify.parameter.SendNotifyBean;
import com.ymatou.iapi.notify.service.CleanNotifyByNotifyIdCall;
import com.ymatou.iapi.notify.service.SendNotifyCall;
import com.ymatou.iapi.userregister.parameter.UserRegisterInfoRequestDtoBean;
import com.ymatou.iapi.userregister.service.UserRegisterInfoRequestDtoCall;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.*;
import com.ymt.utils.tag.*;
import com.ymttest.business.service.JUserCallService;
import com.ymttest.business.service.NotifyCallService;
/**
*删除通知(单条)Test
*FreeMaker Template自动生成代码
*/
@TestSuite
public class Ts_CleanNotifyByNotifyId{
	private static CleanNotifyByNotifyIdBean cleannotifybynotifyidBean;
	private static CleanNotifyByNotifyIdCall cleannotifybynotifyidCall;
	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("删除通知(单条)Test");
	}

	@Before
	public void caseUp() {
		cleannotifybynotifyidBean=new CleanNotifyByNotifyIdBean();
		cleannotifybynotifyidCall=new CleanNotifyByNotifyIdCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(cleannotifybynotifyidCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}
	@Test
	@Category({P1.class})
	@TestCase
	public void Tc_CleanNotifyByNotifyId_001() {
		Logger.start(true,"发送通知后进行删除，成功");
		try {
			UserRegisterInfoRequestDtoBean regbean = JUserCallService.initUserRegisterInfoRequestDtoBean();
			UserRegisterInfoRequestDtoCall urrc = JUserCallService.UserRegisterInfoRequestDtoCall(regbean);
			Integer userId = urrc.getUserid();
			//sendUserId从disconf配置文件中拿
			int sendUserId = 30156393;
			SendNotifyBean sendnotifyBean = NotifyCallService.initSendNotify(sendUserId,userId);
			SendNotifyCall sendNotifyCall = new SendNotifyCall();
			sendNotifyCall.setData(sendnotifyBean);
			sendNotifyCall.callService();
			Logger.verifyEquals("Success",sendNotifyCall.getString("Status"),"验证Status");
			
			int NotifyId = sendNotifyCall.getJsonObject().getAsJsonObject("Result").getAsJsonArray("NotifyIdList").get(0).getAsInt();
			cleannotifybynotifyidBean.setUserId(userId);
			cleannotifybynotifyidBean.setNotifyId(NotifyId);
			
			cleannotifybynotifyidCall.setData(cleannotifybynotifyidBean);
			cleannotifybynotifyidCall.callService();			
			Logger.verifyEquals("Success",cleannotifybynotifyidCall.getString("Status"),"验证Status");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}